<div ng-include="sys_html('common/_header')"></div>
<style>
.fui-btn-c {
    height: auto;
    background: #22ad0c;
    margin: 0.6rem 0.3rem;
    padding: 0.4rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
	justify-content:center;
	box-shadow: 0 8px 6px #1e970a;
    align-items: center;
	color:#fff;
    position: relative;
	border-radius:2rem;
}

.fui-btn-c .icon {
	font-size:1rem;
	padding-right:0.3rem;
	text-align:right;
}

.fui-btn-c .info {
	text-align:left;
    padding-right: 0.2rem;
    font-size: 0.75rem;
}

.fui-btn-c .info p {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.weui_cells_radio2 .weui_check:checked + .weui_icon_checked:before {
  color: #09ba07;
}
.fui-icon-group .fui-icon-col {
    margin: 0.1rem 0;
}
.carousel {margin-top:0}
.fui-header:after {
	border-bottom: 0 solid #D9D9D9;
}
.bottombg {position: absolute;width:100%;height:3.5rem;border-bottom-right-radius:100% 10rem;border-bottom-left-radius:100% 1rem;}
.fui-searchbar {padding-top:0.3rem;padding-bottom:0.3rem;margin-top:-2rem;height:auto;border-top-right-radius:1rem;border-top-left-radius:1rem;}
.searchbar .search-input input {
    height: 1.6rem;
}
.search-input i {
    line-height: 1.7rem;
}
.jylabels {
    display: inline;
    padding: 0 0.5rem;
    margin: 0.2rem;
    font-size: 0.55rem;
    line-height: 1.1rem;
    text-align: center;
    border-radius: 0.6rem;
}
.fui-header a.back:before {
	border-color: #fff
}
.fui-header a.back2:before {
	content: " ";
	display: inline-block;
	-webkit-transform: rotate(45deg);
	-ms-transform: rotate(45deg);
	transform: rotate(45deg);
	height: 0.5rem;
	width: 0.5rem;
	border-width: 0 0 2px 2px;
	border-color: #666;
	border-style: solid;
	position: relative;
	top:0;
}
.carousel {margin-top:0}

.myshop-header {height: auto; background: #fff; overflow: hidden;}
.myshop-header .image {height: 5rem;}
.myshop-header .image img {height: 5rem; width: 100%; display: block;}
.myshop-header .menus {height: 0.5rem; background: #fff; padding: 0.3rem 0 0.3rem 5rem; position: relative; display: -webkit-box;
	display: -webkit-flex;
	display: -ms-flexbox;
	display: flex;}
.myshop-header .menus .shopname {height: 2rem; position: absolute; top: -2.2rem; left: 4.8rem; color:#fff}
.myshop-header .menus .shoplogo {height: 3.5rem; width: 3.5rem; background: #fff; position: absolute; top: -2.5rem; left: 0.8rem; border: 1px solid #eee;border-radius: .2rem}
.myshop-header .menus .shoplogo img {height: 100%; width: 100%; display: block;border-radius: .2rem}
.myshop-header .menus .nav {width: 100%; text-align: center; position: relative; line-height: 2.0rem; font-size: 0.7rem; color: #1e313c;}
.myshop-header .menus .nav:before {content: " "; position: absolute; top: 0; left: 0; width: 0; height: 100%; border-left: 1px solid #f2f2f2;}
.myshop-header .menus .nav p {padding: 0; margin: 0; line-height: inherit;}
.myshop-header .menus .nav i {font-size: .75rem;}
</style>
<div class="fui-page">
	<div class="fui-content">
		<div class="topbg" style="position: relative;text-align:center;width:100%;height:4.5rem;background: {{main.syscolor || '#7c1cc9'}};">
			<div class="fui-header" style="background:none">
				<div class="fui-header-left">
					<a class="back" style="color:#fff" href="javascript:" ng-click="goback()"></a>
				</div>
				<div class="title bold" style="font-size:1rem;color:#fff">{{pagedata.fuwucate.catename || '商户列表'}}</div>
			</div>
		</div>
		<div class="fui-searchbar bar" style="z-index: 0;">
					<div ng-class="{'searchbar':1,'searchbar-active':pagedata.searchbar ==1}" style="background:none;padding-bottom:0.2rem">
							<div style="position: relative;left:0;top:0;">
								<div class="search-input">
									<i id="searchsub" class="icon icon-sousuo1" ng-click="pagedata.getlist()"></i>
									<input type="search" placeholder="请输入商家、服务名称" class="search" ng-model="pagedata.params.keyword" style="text-align: left; color: #999; font-size:0.6rem;background:#fff;border-radius: 1rem;" />
								</div>
							</div>
					</div>
					<div class="row margin0">
							<div ng-repeat="(k,v) in pagedata.bankuai.keywords" class="jylabels jylabel-f3f3f3" style="background-color:#fff" ng-click="pagedata.params.keyword=v;pagedata.getlist();">{{v}}</div>
					</div>
		</div>
		<!-- 滚动后出现 -->
		<div ng-if="showtopheader || pagedata.isgolist" class="fui-header searchtop" style="height:2.6rem;background:#fff">
			<div class="fui-header-left">
				<a class="back2" href="javascript:" ng-click="goback()"></a>
			</div>
			<div class="fui-header-input" style="top:0.5rem;right:0.5rem">
				<div class="searchbar searchbar-active" style="margin-left:1.6rem">
						<div class="search-input" style="margin-right:0.5rem">
							<i id="searchsub" class="icon icon-sousuo1" ng-click="pagedata.getlist()"></i>
							<input type="search" placeholder="请输入商家、服务名称" class="search" ng-model="pagedata.params.keyword" style="text-align: left; color: #999; font-size:0.6rem;background:#f9f9f9;border-radius: 1rem;border: 0 solid #ddd;" />
						</div>
				</div>
			</div>
		</div>
		<div ng-if="pagedata.list[0] && pagedata.list[0].id" style="padding:0 0.5rem 0.4rem 0.5rem">
			<div class="myshop-header" style="border-radius:0.5rem;background:#fff">
				<div class="image">
					<img ng-src="{{pagedata.list[0].topimg || '../addons/jy_merch/resource/images/myshoptop.jpg'}}"/>
				</div>	
				<div class="menus" href="javascript:;" ng-click="access_json('jy_mfuwu/app.index//id='+pagedata.list[0].id)">
					<div class="shoplogo">
						<img ng-src="{{pagedata.list[0].logo || '../addons/jy_merch/resource/images/nologo.png'}}"  />
					</div>		
					<div class='shopname'>
					  <div style="width:100%;font-size:0.8rem">{{pagedata.list[0].merchname || '平台自营'}}</div>
					  <div style="overflow-y: hidden;overflow-x: auto;  white-space:nowrap;position: relative;">
					  <div ng-repeat="c in pagedata.list[0].coupons" class="jylabel jylabel-success" style="background:#5cb85c;color:#fff;margin-right:0.2rem">{{c.title}}</div>
					  <div wx:if="!pagedata.list[0].coupons || pagedata.list[0].coupons.length<1" ng-repeat="c in pagedata.coupons" class="jylabel jylabel-success" style="background:#5cb85c;color:#fff;margin-right:0.2rem">{{c.title}}</div>
					  </div>
					</div>
				</div>
				<div class="fui-cell-title bold" style="font-size: 0.9rem;padding-bottom:0">足不出户，服务到家</div>
				<div href="javascript:;" ng-click="access_json('jy_mfuwu/app.index//id='+pagedata.list[0].id)" class="subtitle" style="padding:0 0.8rem;font-size:0.55rem">
						<div class="jylabel jylabel-red" style="">{{pagedata.list[0].tags}}</div>
				</div>
				<div ng-if="pagedata.list[0].goods.length>0" class="fui-goods-group block" style="padding:0 0.5rem;padding-bottom:0">
									<div ng-repeat="g in pagedata.list[0].goods" href="javascript:;" ng-click="access_json('jy_mfuwu/app.index//id='+pagedata.list[0].id+'&goodsid='+g.id)" class="fui-goods-item" style="width: 25%;border-bottom: 0 solid #e7e7e7">
										<div ng-class="{'image':1, 'echelon':item.active.title}" data-text="{{item.active.title}}" style="height:3.5rem;position:relative;background-image: url('{{tomedia(g.image) ||'../core/resource/images/nopic.jpg'}}')">
												<div ng-show="g.total <=0" class="salez" style="background-image: url('{{tomedia(pagedata.shopset.shop.saleout)}}'); "></div>
												<div ng-if="g.video" class="playbtn"><i class="icon icon-iconfontplay2" style="font-size:1.6rem;"></i></div>
										</div>
										<div class="detail" style="padding-left:0;">
											<div class="name" style="font-size:0.6rem:color:#999">
												{{g.title}}
											</div>
											<div class="price" style="color:#fb5032;margin-top: 0;font-size:0.8rem">
												￥{{g.active.price || g.price}}
											</div>
										</div>
									</div>
				</div>
			</div>
		</div>
		<div ng-if="pagedata.allcates && pagedata.allcates.length>0" class="radius" style="margin:0.3rem">
			<div ng-include="sys_html('common/_merchgroups')"></div>
		</div>
		<div class="fui-list-group" style="margin-top:0;background:none;padding:0 0.2rem">
				<ul class="fui-list" style="font-size:0.65rem;padding:0 0.5rem">
					<li ng-click="pagedata.golist('showlist',0);" class="fui-list-inner bold"><span>综合排序</span><i class="icon icon-moreunfold"></i></li>
					<li class="fui-list-inner"><span></span></li>
					<li ng-click="pagedata.golist('showlist',2);" class="fui-list-inner r"><span>配送速度</span><i class="icon icon-moreunfold"></i></li>
					<li ng-click="pagedata.golist('showlist',3);" class="fui-list-inner r"><span>全部筛选</span><i class="icon icon-moreunfold"></i></li>
				</ul>
				<div class="row margin0" style="padding:0 0.3rem">
					<div class="col-jy-4">
							<div ng-class="{'yuyue-duan':1,'active':pagedata.params.star==5}" style="width:auto" ng-click="pagedata.getlist();pagedata.params.star=5;pagedata.params.order=''">
									<div>5星好评</div>
									<div class="clear"></div>
							</div>
					</div>
					<div class="col-jy-4">
							<div ng-class="{'yuyue-duan':1,'active':pagedata.params.order=='star'}" style="width:auto" ng-click="pagedata.getlist('','star');">
									<div>点评高分</div>
									<div class="clear"></div>
							</div>
					</div>
					<div class="col-jy-4">
							<div ng-class="{'yuyue-duan':1,'active':pagedata.params.order=='brand'}" style="width:auto" ng-click="pagedata.getlist('','brand');">
									<div>品牌商家</div>
									<div class="clear"></div>
							</div>
					</div>
					<div class="col-jy-4">
							<div ng-class="{'yuyue-duan':1,'active':pagedata.params.order=='salenum'}" style="width:auto" ng-click="pagedata.getlist('','salenum');">
									<div>销量较高</div>
									<div class="clear"></div>
							</div>
					</div>
				</div>
		</div>
		<div ng-if="!pagedata.showgoods" class="fui-list-group merchgroup" style="background:none;">
			<div ng-include="sys_html('common/_merchlist')"></div>
			<div ng-if="!loading && (!pagedata.list || pagedata.list.length<1)" class='content-empty' style="margin-top:0">
					<i class='icon icon-lianxishangjia'></i>
					<div>暂时没有任何相关店铺</div>
			</div>
		</div>
		<div ng-if="pagedata.showgoods" class="fui-goods-group block">
				<div ng-include="sys_html('common/_goodslist')"></div>
			</div>
		<div ng-show="loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
		<div ng-include="sys_html('common/_copyright',true)"></div>
	</div>
</div>
<div ng-include="sys_html('common/_search')"></div>
<script type="text/javascript">
scope.pagedata.post={'sendtype':1,'dayid':0}
scope.pagedata.getlist=function(type,order){
	scope.pagedata.isgolist = false;
	scope.pagedata.params.page=1;
	if(order){
		scope.pagedata.params.order=order;
	}
	if(scope.pagedata.params.order){
		scope.pagedata.params.star='';
	}
	if(scope.pagedata.params.star){
		scope.pagedata.params.order='';
	}
	scope.loading=true;
	setTimeout(function(){
		scope.loading=false;
		scope.$evalAsync();
	},500);	
	if(type=='goods'){		
		scope.tool.get_list('jy_mfuwu/index/getgoods/',true)
	}else{
		scope.tool.get_list('jy_mfuwu/index/getmerchs/',true)
	}
}
scope.pagedata.getlist();
scope.pagedata.scroll_bottom=function(){
		if(scope.pagedata.showgoods){
			scope.tool.get_list('jy_mfuwu/index/getgoods/');
		}else{
			scope.tool.get_list('jy_mfuwu/index/getmerchs/');
		}
}
scope.pagedata.golist=function(id,paramstype){
	scope.pagedata.isgolist = true;
	scope.pagedata.paramstype = paramstype;
	scope.$evalAsync();
}
</script>
<script>
scope.pagedata.issocketmsg=false;
scope.pagedata.tanmuspage=0;
scope.pagedata.nowmsgid=0;
scope.pagedata.gettanmus=function() {
	if(!scope.pagedata.issocketmsg){
			scope.get('jy_weishop/get_data/gettanmus/page='+scope.pagedata.tanmuspage,function(res){
						//console.log(res);
						scope.pagedata.tanmus=res.list
						if(scope.pagedata.tanmus.length>0){
							scope.pagedata.tanmuspage++;
							scope.pagedata.up_oldtanmu();
						}
			});
	}
}
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){	
    jinyun_socket.connect(function(res){
			console.log('加入ID为index的组：');console.log(res);
            jinyun_socket.join('index');//加入ID为1的组
     });	 
    jinyun_socket.onsystem=function(res){
        console.log('收到来自后端的消息：');console.log(res);
		scope.pagedata.issocketmsg=true;
		if(scope.pagedata.pluginset.no_tanmu!=1){
			set_tanmu(res.nickname,res.avatar,res.time);
		}
    }
	//刚进入时；如果没有新订单消息，就弹储备订单消息
	if(scope.pagedata.pluginset.no_tanmu!=1){
		setTimeout(function(){
			scope.pagedata.gettanmus();
		},2000);
	}
});
scope.pagedata.up_oldtanmu=function() {
		if(scope.page.action=='merchlist'){
			var i=scope.pagedata.nowmsgid;
			if(i<scope.pagedata.tanmus.length){
				set_tanmu(scope.pagedata.tanmus[i].nickname,scope.pagedata.tanmus[i].avatar,scope.pagedata.tanmus[i].time);
			}else{
				scope.pagedata.gettanmus();
			}
		}else{
			return false;
		}
}
function set_tanmu(nickname,avatar,time) {
		scope.pagedata.nowmsgid++
		scope.pagedata.showtanmus=true
		scope.$evalAsync(scope.pagedata.showtanmus);
		setTimeout(function(){
			scope.pagedata.transition=true
			scope.$evalAsync(scope.pagedata.transition);	
		},300);
		setTimeout(function(){
			scope.pagedata.showtanmus=false
			scope.pagedata.transition=false
			scope.$evalAsync(scope.pagedata.showtanmus);	
		},2000);
		setTimeout(function(){
			//等待5秒，如果没有新的订单消息，就弹储备订单消息
			scope.pagedata.issocketmsg=scope.pagedata.issocketmsg?scope.pagedata.issocketmsg:false;
			if(!scope.pagedata.issocketmsg && scope.page.action=='index'){
				scope.pagedata.up_oldtanmu();
			}
		},4000);
}
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
</script>
<div ng-include="sys_html('common/_footer')"></div>
<div ng-include="sys_html('common/_coupon',true)"></div>
<div ng-include="sys_html('common/_gotop',true)"></div>
<div ng-include="sys_html('common/_share','','','jy_weishop')"></div>
<!--弹目-->
<div ng-if="pagedata.showtanmus && !pagedata.pluginset.no_tanmu" class="video-sms-pane {{pagedata.transition?'transition':''}}">
		<div class="video-sms-text">
			<image class="video-sms-logo" src="{{pagedata.tanmus[pagedata.nowmsgid].avatar}}"/>
			<span class="overflow-h"> 最新订单来自 {{pagedata.tanmus[pagedata.nowmsgid].nickname}}</span>
		</div>
</div>